<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>参数设置</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
    <style>
        .step-indicator {
            display: flex;
            justify-content: space-between;
            margin: 2rem 0;
        }
        .step {
            flex: 1;
            text-align: center;
            padding: 1rem;
            background: #f8f9fa;
            border-radius: 0.5rem;
        }
        .step.active {
            background: #0d6efd;
            color: white;
        }
    </style>
</head>
<body>
    <div class="container py-5">
        <h1 class="mb-4 text-center">参数设置</h1>
        
        <!-- 步骤指示器 -->
        <div class="step-indicator">
            <div class="step">1. 上传文件</div>
            <div class="step active">2. 设置参数</div>
            <div class="step">3. 下载结果</div>
        </div>

        <!-- 错误提示 -->
        {% if error %}
        <div class="alert alert-danger">{{ error }}</div>
        {% endif %}

        <form method="post" action="/params">
            <input type="hidden" name="upload_path" value="{{ upload_path }}">
            <input type="hidden" name="min_date" value="{{ min_date }}">
            <input type="hidden" name="max_date" value="{{ max_date }}">
            <input type="hidden" name="subjects" value="{{ subjects }}">
            
            <div class="row mb-4">
                <div class="col-md-6">
                    <label class="form-label">开始日期</label>
                    <input type="date" class="form-control" name="start_date" 
                           value="{{ min_date }}" required>
                </div>
                <div class="col-md-6">
                    <label class="form-label">结束日期</label>
                    <input type="date" class="form-control" name="end_date" 
                           value="{{ max_date }}" required>
                </div>
            </div>

            <div class="row mb-4">
                <div class="col-md-6">
                    <label class="form-label">正差额利率(%)</label>
                    <input type="number" class="form-control" name="positive_rate" 
                           value="3" step="0.01" min="0" required>
                </div>
                <div class="col-md-6">
                    <label class="form-label">负差额利率(%)</label>
                    <input type="number" class="form-control" name="negative_rate" 
                           value="4" step="0.01" min="0" required>
                </div>
            </div>

            <div class="mb-4">
                <label class="form-label">选择科目</label>
                <div class="border p-3" style="max-height: 300px; overflow-y: auto;">
                    {% for subject in subjects %}
                    <div class="form-check">
                        <input class="form-check-input" type="checkbox" 
                               name="selected_subjects" value="{{ subject }}"
                               {% if loop.index <=3 %}checked{% endif %}>
                        <label class="form-check-label">{{ subject }}</label>
                    </div>
                    {% endfor %}
                </div>
            </div>

            <button type="submit" class="btn btn-primary btn-lg w-100">
                <i class="bi bi-calculator"></i> 开始计算
            </button>
        </form>
    </div>
</body>
</html>
